package models

import (
	"fmt"
	"github.com/astaxie/beego/orm"
)

//直接sql 关联查询
func GetApplyList() (applys []orm.Params) {
	o := orm.NewOrm()
	o.Raw("SELECT * FROM apply").Values(&applys)
	fmt.Println("TestSql...................",applys)
	return applys
}


//直接sql 关联查询
func GetCostList() (costs []orm.Params) {
	o := orm.NewOrm()
	o.Raw("SELECT * FROM entrycard_cost").Values(&costs)
	fmt.Println("TestSql...................",costs)
	return costs
}

//查询入台证详情
func QueryAgreement() (agreements []orm.Params) {
	o := orm.NewOrm()
	o.Raw("SELECT * FROM agreement WHERE id=?",1).Values(&agreements)
	fmt.Println(agreements)
	return agreements
}
//入台证编辑
func AgreementEdit(agreementcontent string) (int64) {
	o := orm.NewOrm()
	res, _ := o.Raw("UPDATE agreement SET content=? WHERE id=?", agreementcontent, 1).Exec()
	num, _ := res.RowsAffected()
	return num
}